NOTE: This Technical Note has been retired. Please see the Technical Notes page for current documentation.

Technical Note PT06
MPW Object Pascal Without MacApp

CONTENTS

[Jan 01 1987]






Introduction

Object Pascal must have a CODE segment named %_MethTables in order to access object methods. In MacApp this is taken care of "behind the scenes" so you don't have to worry about it . However, if you are doing a straight Object Pascal program, you must make sure that %_MethTables is around when you need it. If it's unloaded when you call a method, your Macintosh will begin executing wild noncode and die a gruesome and horrible death.

The MPW Pascal compiler must see some declaration of an object in order to produce a reference to the magic segment. You can achieve this cheaply by simply including ObjIntf.p in your Uses declaration. This must be in the main program, by the way. The compiler will produce a call to %_InitObj which is in %_MethTables.

If you're a more adventurous soul, you can call %_InitObj explicitly from the initialization section of your main program (you must use the {$%+} compiler directive to allow the use of "%" in identifiers). This will load the %_MethTables segment. See Technical Note #93 for ideas about locking down segments that are needed forever without fragmenting the heap.

Back to top

References

M.PT.MPWLoad

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (44K).

Download



Developer Documentation | Technical Q&As | Development Kits | Sample Code